<template>
  <div>
    <div class="container" v-if="data && ranList">
      <div class="prodetail">
        <div class="left">

          <div v-html="data[0].m_0prodetail"></div>

          <img style="width: 900px;margin:10px 0" :src="`/marry pic/${data[0].hz_pic.split('=')[0]}`" alt="" />

          <div v-html="data[0].m_1prodetail"></div>

          <p><img style="width: 900px;margin:10px 0" :src="`/marry pic/${data[0].hz_pic.split('=')[1]}`" alt="" /></p>

          <div v-html="data[0].m_2prodetail"></div>

          <p><img style="width: 900px;margin:10px 0" :src="`/marry pic/${data[0].hz_pic.split('=')[2]}`" alt="" /></p>
          
        </div>
        <div class="right">
        <h2>婚礼套餐推荐</h2>
        <hot-sell-cell v-for="item in ranList" :key="item.pid" :item="item">
        </hot-sell-cell>
      </div>
      </div>
    </div>
  </div>
</template>

<script>
import HotSellCell from "@/components/HotSellCell.vue";
export default {
  components: { HotSellCell },
  methods: {
    getRanData() {
      const url = "/companys/productsRandom?n=6";
      this.axios.get(url).then((res) => {
        // console.log(res)
        console.log("ran的res", res);
        this.ranList = res.data.data;
      });
    },
    getData() {
      const url = `/v2/worker/hz/${this.$route.params.index}`;
      this.axios.get(url).then((res) => {
        console.log("hz的res", res);
        this.data = res.data.data;
      });
    },
  },
  mounted() {
    this.getData();
    this.getRanData();
    // console.log('this.$router',this.$route)
  },
  data() {
    return {
      data: null,
      ranList: null,
    };
  },
};
</script>

<style lang="scss" scoped>
.container {
  width: 1250px;
  margin: 0 auto;
  .prodetail {
    display: flex;
    justify-content: space-between;
    .left {
      width: 60%;
      .title {
        font-size: 30px;
      }
    }
    .right {
      width: 25%;
      h2 {
        margin-bottom: 20px;
      }
    }
  }
}
</style>